package com.github.yoojia.mqtt;

import com.parkingwang.lang.kit.StringKit;

/**
 * @author Yoojia Chen (yoojiachen@gmail.com)
 * @since 1.0.0
 */
final class TopicsOf {

    private TopicsOf() {
    }

    static String subscribe(String service, String nodeId, String type) {
        return "/" + service + "/" + nodeId + "/" + type + "/" + "#";
    }

    static String publish(String service, String nodeId, String type, long id, String senderNodeId, String tag) {
        final String topic = "/" + service + "/" + nodeId + "/" + type + "/" + id + "/" + senderNodeId;
        if (StringKit.isNotEmpty(tag)) {
            return topic + "/" + tag;
        } else {
            return topic;
        }
    }
}
